package com.twu.biblioteca;

/**
 * Created with IntelliJ IDEA.
 * User: apple
 * Date: 18/09/13
 * Time: 6:58 PM
 * To change this template use File | Settings | File Templates.
 */
public class LibraryMenu {

    private MenuItem []menuItems;

    LibraryMenu(MenuItem []menuItems){
        this.menuItems=menuItems;
    }

    public enum MenuItem{
        EXPLORE_MOVIES("Explore Movies"),
        EXPLORE_BOOKS("Explore Books"),
        RESERVE_BOOK("Reserve A Book"),
        CHECK_MEMBERSHIP_DETAILS("Check Membership Details"),
        LOGIN("Login"),
        LOGOUT("Logout"),
        EXIT("Exit");

        private String menuItemName;

        MenuItem(String menuItemName){
            this.menuItemName=menuItemName;
        }

        @Override
        public String toString() {
            return menuItemName;
        }
    }

    public static LibraryMenu preLoginCreateMenu(){
        MenuItem []menuItems={
                MenuItem.EXPLORE_BOOKS,
                MenuItem.EXPLORE_MOVIES,
                MenuItem.LOGIN,
                MenuItem.CHECK_MEMBERSHIP_DETAILS,
                MenuItem.EXIT};

        return new LibraryMenu(menuItems);
    }

    public static LibraryMenu postLoginCreateMenu(){
        MenuItem []menuItems={
                MenuItem.EXPLORE_BOOKS,
                MenuItem.RESERVE_BOOK,
                MenuItem.EXPLORE_MOVIES,
                MenuItem.CHECK_MEMBERSHIP_DETAILS,
                MenuItem.LOGOUT,
                MenuItem.EXIT};

        return new LibraryMenu(menuItems);
    }

    public String displayMenu(){
        String menu="\nLibrary Menu:";
        for(int i=0;i<menuItems.length;i++){
            menu+="\n"+(i+1) + "." +menuItems[i].toString();
        }
        System.out.println(menu);
        return menu;
    }
}
